package com.ad.pet.app.shopcar.confirm.adapter;

import android.support.annotation.Nullable;
import android.widget.ImageView;

import com.ad.pet.R;
import com.ad.pet.models.remote.cart.Coupons;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

/**
 * Created by SEELE on 2018/5/2.
 */

public class CouponsAdaper extends BaseQuickAdapter<Coupons, BaseViewHolder> {
    public CouponsAdaper(@Nullable List<Coupons> data) {
        super(R.layout.item_cheap_paper_layout, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, Coupons item) {
        ImageView imageView = helper.getView(R.id.iv_check);
        imageView.setImageResource(item.isChose() ? R.drawable.ic_chose : R.drawable.ic_unchose);

    }
    /**
     * 返回选中的counry
     * @return
     */
    public Coupons getCoupons(){
        for (int i = 0; i < mData.size(); i++) {
            if (mData.get(i).isChose())
            {
                return mData.get(i);
            }
        }
        return null;
    }

}
